﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.StorageClient;

namespace jp110311.StorageModels
{
    [CLSCompliant(false)]
    public class BbsEntity : TableServiceEntity
    {
        public BbsEntity() : base()
        {
        }

        public BbsEntity( string zipCode, DateTime postAt, string title, string content, string authorZipCode, string authorNick,int localCount )
            : base( zipCode, "M"+ (DateTime.MaxValue.Ticks- postAt.Ticks).ToString("D20")+localCount.ToString("D10"))
        {
            ZipCode = zipCode;
            PostAt = postAt;
            Title = title;
            Content = content;
            AuthorNick = authorNick;
            AuthorZipCode = authorZipCode;
        }

        protected DateTime PostAt { get; set; }
        protected string ZipCode { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
        public string AuthorZipCode { get; set; }
        public string AuthorNick { get; set; }
        public string TagList { get; set; }
    }

    [CLSCompliant(false)]
    public class BbsIndexEntity : TableServiceEntity
    {
        public BbsIndexEntity() : base()
        {
        }

        public BbsIndexEntity( string zipCode )
            : base( zipCode , "INDEX")
        {
            ZipCode = zipCode;
        }

        public string ZipCode { get; set; }
        public int MessageCount { get; set; }
        public string MessageIDs0 { get; set; }
        public string MessageIDs1 { get; set; }
        public string MessageIDs2 { get; set; }
        public string MessageIDs3 { get; set; }
        public string TagList { get; set; }
    }


    [CLSCompliant(false)]
    public class BbsTagEntity : TableServiceEntity
    {
        public BbsTagEntity() : base()
        {

        }

        public BbsTagEntity( string zipCode, string tagName, string bbsEntityRowKeys )
            : base( zipCode, tagName )
        {
            BbsEntityRowKeys = bbsEntityRowKeys;
        }

        public string BbsEntityRowKeys { get; set; }
        public int MessageCount { get; set; }
    }
}
